﻿<UserControl x:Class="Samba.Modules.NavigationModule.NavigationView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:FlexButton="clr-namespace:FlexButton;assembly=FlexButton" mc:Ignorable="d" 
             xmlns:local="clr-namespace:Samba.Modules.NavigationModule"
             d:DesignHeight="600" d:DesignWidth="600"
             d:DataContext="{d:DesignInstance local:NavigationViewModel, IsDesignTimeCreatable=True}"
             Margin="-5">
    <Grid>

        <Border Opacity="0.5">
            <Border.Background>
                <ImageBrush ImageSource="Images/Wallpaper3.jpg" />
            </Border.Background>
        </Border>

        <Border Background="#397A7779" Margin="25" BorderThickness="5" BorderBrush="#59000000" CornerRadius="15">

        </Border>

        <ItemsControl Margin="40" ItemsSource="{Binding CategoryView}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <UniformGrid Columns="3"/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Button Name="btn" Command="{Binding}" Margin="10">
                        <Button.Style>
                            <Style TargetType="{x:Type Button}">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type Button}">
                                            <Grid>
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="80*"/>
                                                    <RowDefinition Height="20*"/>
                                                </Grid.RowDefinitions>
                                                <Grid Grid.Row="0" x:Name="ContentGrid">
                                                    <Border BorderBrush="#270C0C41" BorderThickness="5" CornerRadius="8">
                                                        <Border.Background>
                                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                                <GradientStop Color="#47969696" Offset="0" />
                                                                <GradientStop Color="#6F111114" Offset="1" />
                                                            </LinearGradientBrush>
                                                        </Border.Background>
                                                    </Border>
                                                    <Border Margin="5" BorderThickness="1" CornerRadius="5" Background="Transparent">
                                                        <Border.BorderBrush>
                                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                                <GradientStop Color="#69D1D1D1" Offset="0" />
                                                                <GradientStop Color="#FFBABABA" Offset="1" />
                                                            </LinearGradientBrush>
                                                        </Border.BorderBrush>
                                                    </Border>
                                                    <Grid>
                                                        <Grid.RowDefinitions>
                                                            <RowDefinition Height="10*"/>
                                                            <RowDefinition Height="45*"/>
                                                            <RowDefinition Height="45*"/>
                                                        </Grid.RowDefinitions>
                                                        <Viewbox Grid.Row="2" MinHeight="20" Margin="15,5" Name="textbox">
                                                            <TextBlock Foreground="#BDF5F5F5" FontWeight="Bold" Text="{Binding Caption}">
                                                            <TextBlock.Effect>
                                                                <DropShadowEffect ShadowDepth="1" BlurRadius="2" Opacity="0.5" />
                                                            </TextBlock.Effect>
                                                            </TextBlock>
                                                        </Viewbox>
                                                        <Image Grid.Row="1" Source="{Binding ImageSource}" Stretch="Uniform" StretchDirection="DownOnly">
                                                            <Image.Effect>
                                                                <DropShadowEffect ShadowDepth="1" BlurRadius="2" Opacity="0.5" />
                                                            </Image.Effect>
                                                        </Image>

                                                    </Grid>
                                                </Grid>
                                                <Border Grid.Row="1">
                                                    <Border.OpacityMask>
                                                        <LinearGradientBrush StartPoint="1,0">
                                                            <GradientStop Offset="0" Color="#80000000"/>
                                                            <GradientStop Offset="0.8" Color="#00000000"/>
                                                            <GradientStop Offset="1" Color="#00000000"/>
                                                        </LinearGradientBrush>
                                                    </Border.OpacityMask>
                                                    <Border.Background>
                                                        <VisualBrush
                                                             Visual="{Binding ElementName=ContentGrid}"
                                                             AutoLayoutContent="False"
                                                             Stretch="None"
                                                             AlignmentX="Left"
                                                             AlignmentY="Bottom"
                                                            >
                                                            <VisualBrush.RelativeTransform>
                                                                <TransformGroup>
                                                                    <ScaleTransform ScaleY="-1" CenterY="1"/>
                                                                    <TranslateTransform Y="-1" />
                                                                </TransformGroup>
                                                            </VisualBrush.RelativeTransform>
                                                        </VisualBrush>
                                                    </Border.Background>
                                                </Border>
                                            </Grid>
                                            <ControlTemplate.Triggers>
                                                <Trigger Property="IsPressed" Value="True">
                                                    <Setter TargetName="textbox" Property="Margin" Value="20"/>
                                                </Trigger>
                                                <Trigger Property="IsEnabled" Value="False">
                                                    <Setter Property="Opacity" Value="0.4"/>
                                                </Trigger>
                                            </ControlTemplate.Triggers>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </Button.Style>
                    </Button>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Grid>
</UserControl>
